<template>
  <div class="like-page">
    <van-nav-bar
  title="我的点赞" :fixed="true"
/>
<van-list
  v-model="loading"
  :finished="finished"
  finished-text="没有更多了"
  @load="onLoad"
>
    <!-- v-for循环列表-->
    <article-item :item="item" v-for="item in list" :key="item.id"></article-item>
</van-list>
  </div>
</template>

<script>

import { getCollectsOrLikes } from '@/api/article'
export default {
  name: 'like-page',
  data () {
    return {
      list: [],
      loading: false,
      finished: false,
      page: 1
    }
  },
  methods: {
    async onLoad () {
      const res = await getCollectsOrLikes({
        page: this.page,
        pageSize: 10,
        optType: 1
      })
      this.page++
      this.list = this.list.concat(res.data.data.rows)
      this.loading = false
      if (this.page > res.data.data.pageTotal) {
        // 说明没有更多数据了
        this.finished = true
      }
    }

  }
}
</script>

<style lang="less" scoped>
.like-page {
  margin-bottom: 50px;
  margin-top: 44px;
}
</style>
